
<!DOCTYPE html>
<html>
<head>
<title>状 态</title>
<meta charset="utf-8" >
<meta name="renderer" content="webkit">
<meta name="author" content="XYB" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="format-detection" content="telphone=no, email=no"/>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta name="viewport" content="initial-scale=1, maximum-scale=3, minimum-scale=1, user-scalable=no">
<link rel="stylesheet" href="../../static/css/bootstrap.min.css">
<link rel="stylesheet" href="../../static/css/paging.min.css">
<link rel="stylesheet" href="../../static/css/init.css">
<link rel="stylesheet" href="../../static/css/common.css">
<link rel="stylesheet" href="../../static/css/faq/faq.css">
<link rel="icon" href="../../static/images/favicon.ico" type="image/x-icon">
<style>
.status-area{
	padding:10px 10px 120px 10px;
}
.status-tables{
	width:96%;
	margin-left:auto;
	margin-right:auto;
	border:1px solid #333;
}
.status-tables thead tr{
	background: #d9edf7;
}
.status-tables tr{
	border-top:1px solid #333;
}
.status-tables tr td{
	text-align: center;
	height:45px;
	line-height:45px;
	font-size:14px;

}

.status-tables tr td:nth-child(2),
.status-tables tr td:nth-child(4),
.status-tables tr td:nth-child(6),
.status-tables tr td:nth-child(8){
	border-left:1px solid #333;
	border-right:1px solid #333;
}
.status-tables tr td:nth-child(10){border-left:1px solid #333;}

.status-tables tbody tr:nth-child(odd){
	background:#fff;
}
.status-tables tbody tr:nth-child(even){
	background:#d7d7d7;
}
</style>
</head>
<body>
    <header id="header" class="relative full-x"></header>

    <div class="allwarp relative">

        <div class="main-Content">
        	<div class="search-cont bg-fff mt-20">
        		<label class="ml-20">用户:</label><input type="text" class="name search-intxt rad-3"/>
        		<label>结果:</label>
        		<select class="search-intxt rad-3" id="Result">
        			 <option selected value="">All</option>
			          <option value="AC-4">AC-4</option>
			          <option value="编译错误-11">编译错误-11</option>
			          <option value="Wrong Answer-6">Wrong Answer-6</option>
        		</select>
        		<label>语言:</label>
        		<select class="search-intxt rad-3" id="Language">
        			<option selected value="">All</option>
					<option value="C">C</option>
          			<option value="C++">C++</option>
          			<option value="java">Java </option>
          			<option value="python">Python</option>
        		</select>
        		<a href="javascript:;" class="search-btn rad-3 text-center f-14 c-fff ml-20" onclick="searchStateFun(1)">go</a>
        	</div>
            <div class="common-cont status-area mt-10 full-x bg-fff">
            	<table class="status-tables">
            		<thead>
						<tr>
							<td>状态号</td>
							<td>昵称</td>
							<td>pid</td>
							<td>结果</td>
							<td>语言</td>
						</tr>
					</thead>
					<tbody id="statusListTables"></tbody>
				</table>
				<div class="paging-area-box mt-10 magin-auto">
					<div class="paging-area float-left" id="pagination"></div>
					<span class="pageNum float-right f-14">共<em>0</em>条数据</span>
				</div>
            </div>
        </div>
    </div>
    <footer id="footer" class="full-x f-14 c-666 text-center"></footer>
</body>
<script src="../../static/js/util/jquery-1.9.1.min.js"></script>
<script src="../../static/js/util/bootstrap.min.js"></script>
<script src="../../static/js/util/jquery.paging.min.js"></script>
<script src="../../static/js/commonJS/interface.js"></script>
<script src="../../static/js/commonJS/common.js"></script>
<script>
	function tableListFun(pageNo){
        var id = window.document.getElementById("statusListTables");

        $.ajax({
            url: get_stateList_interface+'?currentPage='+pageNo,
            type:'post',
            dataType:'json',
			xhrFields:{
				withCredentials:true
			},
			crossDomain:true,
            data:{
                currentPage:pageNo
            },
            success: function(data) {

                if(data.code==200){
                    innerTbody(data,id, tableListFun);
                }else{
                    $.message(data.msg);
                }
            },
            error: function (error) {
                $.message("链接超时，请刷新...");
            }
        });
    }


    function searchStateFun(pageNo){

        var name = $(".name").val();
        var Result = $("#Result").val();
        var Language = $("#Language").val();

        var id = window.document.getElementById("statusListTables");

        // if(name==""){
        //     $.message("请输入用户名");
        //     return;
        // }

        $.ajax({
            url: search_stateList_interface+"?currentPage="+pageNo,
            type:'post',
            dataType:'json',
			xhrFields:{
				withCredentials:true
			},
			crossDomain:true,
            data:{
				searchUser: name,
				language: Language,
                Result:Result,
            },
            success: function(data) {
                if(data.code==200){
                	for(var i=0;i<data.data.list.length;i++){
						data.data.list[i]['code_status']=data.data.list[i]['result']
					}
                    innerTbody(data,id, searchStateFun);
                }else{
                    $.message(data.msg);
                }
            },
            error: function (error) {
                $.message("链接超时，请刷新...");
            }
        });
	}


    tableListFun(1);

    function innerTbody(data,id, func){
        var page = data.data.num;
        var currentPage = data.data.currentPage;
        var tml = "";
        $(".pageNum em").html(page);
        if(page>0){
            setPagination(page,currentPage, func);
            var lists = data.data.list;
            $('#pagination').show();
            for (var x=0; x< lists.length;x++) {
                tml += "<tr>"+
                    '<td>'+lists[x]["submit_id"]+'</td>'+
                    '<td>'+lists[x]["nickname"]+'</td>'+
                    '<td>'+lists[x]["question_id"]+'</td>'+
					'<td>'+lists[x]["code_status"]+'</td>'+
                    '<td>'+lists[x]["language"]+'</td>'+
                    "</tr>" ;
            }
        }else{
            $('#pagination').hide();
        }
        id.innerHTML = tml;
    }

</script>
</html>